function register() {
    let imgPath="";
    document.getElementsByName("img").forEach(n=> {
        if (n.checked) {
            imgPath = n.value;
        }
    })
    axios.get("/user/register",{
        params:{
            name:$("userName").value,
            pwd:$("pwd").value,
            email:$("email").value,
            img:imgPath
            }
    }).then(resp=>{
        if (resp.data =="ok"){
            location.href = "/login.html"
        }else if(resp.data == "no"){
            $("errorDiv").innerHTML = "用户名已注册";
            $("userName").value="";
        }
    })

}